/**
 * @开发版权 
 * @项目名称 轻量数据中台(LDMP)
 * @版本信息 v1.0
 * @开发人员 zhous
 * @开发日期 2025-01-17
 * @修订日期
 * @描述  ApplicationClosedEventListener
 */
package com.ng.common.listener;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.stereotype.Component;

import com.ng.biz.service.IDatasource;
import com.ng.biz.service.IMqttClient;
import com.ng.common.timer.DataTaskTimer;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Component
public class ApplicationClosedEventListener implements ApplicationListener<ContextClosedEvent> {

	@Autowired
	private IDatasource datasourceImpl;
	
	@Autowired
	private IMqttClient mqttClientImpl;
	
	@Autowired
	private DataTaskTimer dataTaskTimer;
	
	@Override
	public void onApplicationEvent(ContextClosedEvent event) {
		datasourceImpl.stopAll();
		mqttClientImpl.stopAllBoot();
		dataTaskTimer.stopAllBoot();
	}

}
